from flask import Flask
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

# 创建实例
app = Flask(__name__)
app.config.from_object('config.Config')
db.init_app(app)

with app.app_context():
    # 确保在初始化数据库之前导入模型
    # 此处需要在models/__init__.py中进行相关import
    from app.models import *

    # 注册路由
    # views/__init__.py中进行相关import
    from app.views import *

    db.create_all()


